#pragma once

#include <ClanLib/core.h>
#include <ClanLib/network.h>

namespace Game { class GameManager; }
namespace Account { class AccountManager; }
namespace Render { class RenderManager; }

namespace Network
{
	class Client
	{
	public:
		Client();
		~Client();

		void exec();

		void sendEvent(const CL_NetGameEvent &gameEvent);

	private:
		void onConnected();
		void onDisconnected();

		void onEventReceived(const CL_NetGameEvent &e);

		void onEventLoginSuccess(const CL_NetGameEvent &e);
		void onEventLoginFail(const CL_NetGameEvent &e);
		
		CL_Event stop_event;
		
		CL_ConsoleLogger *logger;
		CL_NetGameClient *net_game;
		CL_SlotContainer slots;
		CL_String port;
		CL_String ip_address;

		bool quit;

		Game::GameManager *gameMgr;
		Account::AccountManager *accountMgr;
		Render::RenderManager *renderMgr;
	};
}
